/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.evolve.webbot.file;
import com.evolve.webbot.util.Utileria;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
import org.apache.log4j.Logger;
/**
 *
 * @author DarthAE
 */
public class CoppelDataFile 
{
  private String path;
  Utileria util = new Utileria();
  private SimpleDateFormat sdf01 = new SimpleDateFormat("MM");
  static Logger log = Logger.getLogger(CoppelDataFile.class);
  
  private static final String HEADERFST="num_proveedor|nom_proveedor|codigo|modelo|precio_costo|precio_venta";
  private static final String HEADERSND="venta_ultimos_13_periodos|existencia|rotacion_por_sku";
  
  public CoppelDataFile(){}
     
  public CoppelDataFile(String path)
  {
     this.path = path;
  }
  
  public String createHeaderFileCoppel(Date date)
  {
     String header="";
     
     String strArray[]= new String[3];
     
     GregorianCalendar calendar = new GregorianCalendar();
     calendar.setTime(date);
     
     /*calendar.add(calendar.MONTH,-1);*/
     
     for(int i=0;i<3;i++)
     {
       if(i>0)
       {
          calendar.add(calendar.MONTH,-1);
       }  
       
       strArray[i] = sdf01.format(calendar.getTime());
       
       //log.info("mes en curso "+sdf01.format(calendar.getTime()));
       //header="|"+"periodo_"+sdf01.format(calendar.getTime())+header;             
     }
         
     header=HEADERFST+"|periodo_"+strArray[0]+"|periodo_"+strArray[1]+"|periodo_"+strArray[2]+"|"+HEADERSND;
       
     log.info(header);
        
     return header;
  }  
}
